package com.lex.sms;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.view.View;

import com.lex.TestRetrofitActivity;
import com.lex.activitytext.R;

/**
 * Created by Administrator on 2016/6/30.
 */
public class ImageSendSMSActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image_send_sms);
    }

    public void sendVc(View v){
        PendingIntent pendingIntent = PendingIntent.getActivity(this,0,new Intent(this, TestRetrofitActivity.class),0);
        final Notification notification = new Notification.Builder(this)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setTicker("你收到一条验证码")
                .setContentTitle("你收到了记事本APP的验证码")
                .setContentText("你的记事本APP注册码为3456，请在5分钟内完成注册。")
                .setContentIntent(pendingIntent).getNotification();
        notification.flags = Notification.FLAG_AUTO_CANCEL;

        final NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);;
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                manager.notify(100,notification);
            }
        },2000);
    }
}
